/*
 * PhoneTest.java
 *
 * This program uses the MobilePhone class to demonstrate exception handling.
 *
 * 
 */

package com.javacore.day9.phone;

import java.util.Scanner;

/**
 * PhoneTest class displays a menu to add phone numbers to the mobile phone
 * database and allows a user to send messages.
 * @author 
 */
public class PhoneTest {
    
    /**
     * Creates a new instance of PhoneTest
     */
    public PhoneTest() {
    }
    
    /**
     * This is the entry point of the application.
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        
        // Create an instance of MobilePhone class
        MobilePhone objNokia = new MobilePhone();
        
        Scanner input = new Scanner(System.in);
        
        // Variable to store user's choice
        byte choice ;
        
        // Iterate until the chooses to exit the application
        do {
            System.out.printf("\nSelect an operation from the following:");
            System.out.println("\n1. Add phone numbers \n2. Send Message\n3. Exit");
            
            // Accept the choice from the user
            System.out.println("Enter the choice: ");
            choice = input.nextByte();
            
            // Invoke the methods of MobilePhone class depending on the 
            // operation selected by the user
            if(choice == 1) {
                objNokia.setPhoneNumbers();
            } else if (choice == 2) {
                objNokia.sendMessage();
            }
        } while(choice != 3);
    }
}
